<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ include file="/pages/jsp/internal/include.jsp" %>

<div class="inner_cont" > 

	<h2><fmt:message key="label.userList"/></h2>
	
	<span class="note">
		<fmt:message key="page.userList.description"/>
		<c:forEach items="${model.messages}" var="message">
			<div id="message"><fmt:message key="${message}"/></div>
		</c:forEach>
		
		<c:forEach items="${model.errors}" var="error">
			<div id="error">
				<fmt:message key="${error.key}">
					<fmt:param value="${error.param1}"/>
				</fmt:message>
			</div>
		</c:forEach>
	</span>

<form  id="manageUserForm" class="form" method="post">
	
	<table class="tableDati col tablesorter" id="userListTable">
		
	 	<thead>
			<tr>
				<th><fmt:message key="th.id"/></th>
	   			<th><fmt:message key="th.mail"/></th>
	   			<th><fmt:message key="th.pwd"/></th>
				<th><fmt:message key="th.startDate"/></th>
				<th><fmt:message key="th.activationCode"/></th>
				<th><fmt:message key="th.newsLetter"/></th>
				<th><fmt:message key="th.admin"/></th>
	   		</tr>
	   	</thead>
	   	<tfoot>
	   		<tr>
				<th><fmt:message key="th.id"/></th>
	   			<th><fmt:message key="th.mail"/></th>
	   			<th><fmt:message key="th.pwd"/></th>
				<th><fmt:message key="th.startDate"/></th>
				<th><fmt:message key="th.activationCode"/></th>
				<th><fmt:message key="th.newsLetter"/></th>
				<th><fmt:message key="th.admin"/></th>
	   		</tr>
	   	</tfoot>
 
 		<tbody>
			<c:forEach items="${model.users}" var="user" varStatus="i">
				<tr>
					<td style="text-align:center"><input type="checkbox" name="userId" value="<c:out value="${user.id}"/>"></td>
			   		<td><c:out value="${user.mail}"/></td>
					<td><c:out value="${user.pwd}"/></td>
					<td><fmt:formatDate pattern="dd/MM/yyyy"   value="${user.startDate}"/></td>
					<td><c:out value="${user.activationCode}"/></td>
					<td>
						<c:choose>
							<c:when test="${user.newsLetter==1}">
								Si
							</c:when>
							<c:otherwise>
							    No
							</c:otherwise>
						</c:choose>
						
					</td>
					<td>
						<c:choose>
							<c:when test="${user.admin==1}">
								Si
							</c:when>
							<c:otherwise>
							    No
							</c:otherwise>
						</c:choose>
					</td>
			   	</tr>
			 </c:forEach>
		</tbody>
	</table>
	<div  id="pager" style="position:relative;top:0px">
		<form>
			<img src="<c:url value="/js/table/first.png"/>" class="first"/>
			<img src="<c:url value="/js/table/prev.png"/>" class="prev"/>
			<input type="text" class="pagedisplay"/>
			<img src="<c:url value="/js/table/next.png"/>" class="next"/>
			<img src="<c:url value="/js/table/last.png"/>" class="last"/>
			<select class="pagesize">
				<option selected="selected" value="10">10</option>
				<option value="20">20</option>
				<option value="30">30</option>
				<option value="40">40</option>
			</select>
		</form> 
	</div>
	<br/>
	<div class="action_bar">
		<input type="button" class="puls" value="<fmt:message key="label.delete"/>" onclick="sendFormForAction('<c:url value="/user/manageUsers.htm"/>','manageUserForm','body','delete');"/>
	</div>
</form>
</div>

<script>
	$(document).ready(function() { 
		//debugger;
		$("#userListTable").tablesorter({
				widthFixed: true,
				dateFormat: "uk"
				}).tablesorterPager({container: $("#pager")}); 
	}); 
</script>
